{extend name="public:base"/}

{block name="title"}<?=$config['tableCnName']?>列表{/block}
{block name="style"}{/block}

{block name="main"}

<section class="content">

    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header m-b-sm">
                    <h3 class="box-title"><?=$config['tableCnName']?>列表</h3>
                </div>
                <!--
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="/backend/addons/rf-merchants/config/index"> 配置管理</a></li>
                        <li><a href="/backend/addons/rf-merchants/config-cate/index"> 配置分类</a></li>
                        <li class="pull-right">
                            <a class="btn btn-primary btn-xs" href="/backend/addons/rf-wechat/rule/edit"><i
                                    class="fa fa-plus"></i> 创建</a>
                        </li>
                    </ul>
                </div>
                -->
                <div class="farPaddingJustV from-search">
                    <div class="col-sm-8">
                        <form method="get" action="">
<?php if(!empty($config['search'])){ foreach($config['search'] as $k=>$v){?>
        <?php if(isset($v['required']) && $v['required'] ){?>
    <?php if($v['type'] == 'text'){?>

                            <div class="col-sm-3">
                                <div class="form-row">
                                    <input type="text" class="form-control" name="<?=$v['field']?>"
                                           placeholder="<?=$v['comment']?>" value="<?php echo '<?=input(\''.$v['field'].'\')?input(\''.$v['field'].'\'):\'\'?>' ?>">
                                </div>
                            </div>
    <?php }else if($v['type'] == 'select'){?>

                                <div class='col-sm-3'>
                                    <select id="<?=$v['field']?>" class="form-control" name="<?=$v['field']?>">
                                        <option value="0">请选择</option>
                                        <?php if(!empty($v['values'])){foreach($v['values'] as $k1=>$v1):?>
                                        <option value="<?=$k1?>" ><?=$v1?></option>
                                        <?php endforeach;}?>
                                    </select>
                                    <div class="help-block"></div>
                                </div>
    <?php } ?>


<?php }}} ?>

                            <div class="col-sm-3">
                                <div class="form-row">
                                    <span class="input-group-btn">
                                        <button class="btn btn-white"><i class="fa fa-search"></i> 搜索</button>
                                    </span>
                                </div>
                            </div>

                        </form>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="box-body table-responsive">

                    <?php if(in_array('create',$action)){?>
                    <div class="menu-buttons m-b-sm">
                        <a href="<?php echo '<?=url(\''.$module.'/'.$controller_name.'/create'.'\')?>'?>" class="btn btn-sm btn-primary"><i class="fa fa-plus" ></i> 新增<?=$config['tableCnName']?></a>
                    </div>
                    <?php }?>

                    <table id="table-index" class="table table-hover"><thead>
                    <tr>
                        <th style="width: 10%;">ID</th>
<?php foreach($config['form_fields'] as $k=>$v){?>
     <?php if($v['is_visible'] == 1){?>

                        <th style="width: 10%;"><?=$v['text']?></th>
     <?php } ?>
<?php } ?>
                        <th style="width: 10%;">操作</th>
                    </tr>

                    </thead>
                        <tbody>

 <?php echo '<?php if(!empty($dataProvider)){foreach($dataProvider as $k=>$v): ?>'?>

                        <tr>
                            <td><?php echo '<?=$v[\''.$config['pri_key'].'\']?>' ?></td>
    <?php foreach($config['form_fields'] as $k=>$v): ?>
        <?php if($v['is_visible'] == 1){?>

                            <td>
                                <span class="m-l-sm"><?php echo '<?=$v[\''.$k.'\']?>'?></span>
                            </td>
        <?php } ?>
    <?php endforeach;?>

                            <td>
                                <?php if(in_array('update',$action)){?>
                                <a class="btn btn-primary btn-xs" title="编辑" href="<?php echo '<?=url(\''.$module.'/'.$controller_name.'/update'.'\','.'[\''.$config['pri_key'].'\'=>$v[\''.''.$config['pri_key'].'\']]'.')?>'?>"><i class="fa fa-edit"></i> 编辑</a>
                                <?php }?>

                                <?php if(in_array('view',$action)){?>
                                <a class="btn btn-info btn-xs" title="查看" href="<?php echo '<?=url(\''.$module.'/'.$controller_name.'/view'.'\','.'[\''.$config['pri_key'].'\'=>$v[\''.''.$config['pri_key'].'\']]'.')?>'?>"><i class="fa fa-eye"></i> 查看</a>
                                <?php }?>

                                <?php if(in_array('delete',$action)){?>
                                <a class="btn btn-danger btn-xs" title="删除" href="<?php echo '<?=url(\''.$module.'/'.$controller_name.'/index'.'\','.'[\''.$config['pri_key'].'\'=>$v[\''.''.$config['pri_key'].'\']]'.')?>'?>" onclick="ptyConfirmDelete('<?php echo '<?=url(\''.$module.'/'.$controller_name.'/delete'.'\','.'[\''.$config['pri_key'].'\'=>$v[\''.''.$config['pri_key'].'\']]'.')?>'?>');return false;"><i class="fa fa-trash-o"></i> 删除</a>
                                <?php }?>

                            </td>
                        </tr>

  <?php echo '<?php endforeach; } ?>'?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
</section>
{/block}

{block name="js"}
{/block}


